    [(#REM) Check whether files upload block must be added to this form ]
    <BOUCLE_checkfiles(CONDITION){si #ENV{config}|table_valeur{attach_files}|table_valeur{allow_attach}|=={1}}>
<div>        
        [<span class='erreur'>(#ENV**{erreurs}|table_valeur{file})</span>]
        <label for="file"><:feedback:attach_file:></label>
        <div class="warning">
            <:feedback:max_file_size:> [(#ENV{config}|table_valeur{attach_files}|table_valeur{max_size})] <:feedback:kilobytes:>!<br />
            <?php $allowed_types = '[(#ENV{config}|table_valeur{attach_files}|table_valeur{allowed_types})]';
                  if ($allowed_types && $allowed_types != '*') {
                     $allowed_types = str_replace('|',', ',$allowed_types);
                     echo _T('feedback:upload_files_allowed_types').': '.$allowed_types;
                  }
             ?>
             <br />
             <?php
                $min_files = '[(#ENV{config}|table_valeur{attach_files}|table_valeur{min_files})]';
                if ($min_files)
                    echo _T('feedback:min_files_must_be_loaded').': '.$min_files;
             ?>             
        </div>
        <div class="files_div">
            <?php //$min_files = '[(#ENV{config}|table_valeur{attach_files}|table_valeur{min_files})]';                 
                if (!$min_files) $min_files=1; 
                for ($i=0;$i<$min_files;$i++) {
                ?>
                    <input class="file_input" type="file" name="file<?php echo $i; ?>" /><br />
                <?php } ?>            
        </div>
        <a href="javascript:;" class="file_add">Добавить</a>                
       <script type="text/javascript">        
        $(document).ready(function(){
            var max_files = '[(#ENV{config}|table_valeur{attach_files}|table_valeur{max_files})]';
            var files_num = $('.form_#FORM .file_input').length;
            
            $('.form_#FORM .file_add').live('click',function(){                  
                files_num = $('.form_#FORM .file_input').length;                
                if (files_num < max_files) {                    
                    $('.form_#FORM .files_div').append('<input class="file_input" type="file" name="file'+(files_num+1)+'" /><br />');
                    
                }                
                hide_add_link(); 
            });
            
            hide_add_link();
            function hide_add_link() {                          
                files_num = $('.form_#FORM .file_input').length;
                if (files_num > max_files-1)
                    $('.form_#FORM .file_add').hide();
            }
        });
        </script>
</div>
    </BOUCLE_checkfiles>